<?php

include("inc/functions.php");

$mysqldate = date( 'Y-m-d H:i:s', $phpdate );
$phpdate = strtotime( $mysqldate );
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" lang="de" >

<head> 
	<meta http-equiv="content-type" content="text/html; charset=utf-8" /> 
	<title><? echo $mClass::returnName(); ?>: Registration</title>
</head>

<link rel="shortcut icon" href="img/favicon.ico" type="image/vnd.microsoft.icon" /> 

<style>
body

{

	margin: 10px;
	padding: 10px;

	color: #FFFFFF;

	background-color: #000000;

}
#font

{
	text-align: left;
	font-size: 10px;

	font-family: Verdana;

}

</style>
<img src="img/loader.gif" style="position:absolute; margin: -1500px; left: 20px; top: 20px;" /> 

<center>
	<table cellspacing=0 cellpadding=0 style="height: 60px;">
		<tr>			<td style="font-size: 20px; width: 300px;" id="font">

				Account Information			</td>
			<td>
				<img src="img/logo.gif" style="float: right">			</td>
		</tr>
	</table>
	
	<table cellspacing=0 cellpadding=0>
		<tr>

			<td style="vertical-align: top;">
				<div><img src="img/line.gif" style="width: 420px; height: 1px;"></div>

			</td>
		</tr>
		<tr>

			<td style="vertical-align: top;" id="font">
	
			<center><div style="width: 350px; padding: 15px;"><font style="color: #00CCDB;">Please supply <b>valid</b> details! You need your email address and password to sign in.</font></div>
   <?php
   $date = date('Y-m-d');
   $user = mysql_real_escape_string(strip_tags($_POST['user']));
   $pass = sha1(mysql_real_escape_string(strip_tags($_POST['pass'])));
   $passo = sha1(mysql_real_escape_string(strip_tags($_POST['passo'])));
   $email = mysql_real_escape_string(strip_tags($_POST['email']));
   $sql = mysql_query("SELECT * FROM users WHERE username = '$user'");
   $sql = mysql_num_rows($sql);
   
   $emailcheck = mysql_query("SELECT * FROM users WHERE email = '$email'");
   $emailcheck = mysql_num_rows($emailcheck);

   $sso = rand();
   
   if($user == "" || $pass == "" || $passo == "" || $email == "")
   {
     echo "You have entered a field blank, <a href='http://dev.winterpartys.org?cake=".$cake."'>try again</a>";
   }
   else if($pass != $passo)
   {
     echo "The two password fields do not match, <a href='http://dev.winterpartys.org?cake=".$cake."'>try again</a>";
   }
   else if($sql==1)
   {
     echo "Your username chosen already exists!, <a href='http://dev.winterpartys.org?cake=".$cake."'>try again</a>";
   }
   else if($emailcheck==1)
   {
     echo "Your email chosen already exists!, <a href='http://dev.winterpartys.org?cake=".$cake."'>try again</a>";
   }
   else
   {
     $_SESSION['name'] = $user;
     $ip = $_SERVER['REMOTE_ADDR'];
	 $rep = str_replace("\'", "'", $user);
     mysql_query("INSERT INTO users (username, password, role, signedup, email, dob, motto, figure, gender, coins, films, gametickets, activitypoints, ssoticket, flat) VALUES ('$user', '$pass', '1', '$date', '$email', '', 'I love aleeda!', 'hd-180-1.ch-255-64.lg-270-64.sh-300-62.hr-165-1316', 'M', '300', '0', '0', '400', '$sso', '1')") or die(mysql_error());;
     echo "Thanks for registering, <b>$rep</b> <a href='http://dev.winterpartys.org?cake=".$cake."'>continue here</a>";
   }      ?>
			</td>
		</tr>
	</table>
	<table cellspacing=0 cellpadding=0>

		<tr>


			<td style="vertical-align: top;">

				<!-- <div style="background-image:url(img/line.gif); background-repeat:repeat-x; width: 420px;"><center><img src='img/line_open.gif'></center></div>
				-->

			</td>

		</tr>

	</table>


	<table cellspacing=0 cellpadding=0>

							</table>

				</center></div>

			</td>
		</tr>
	</table>	
	<br><table cellspacing=0 cellpadding=0 style="height: 10px;">
		<tr>			<td style="vertical-align: top;">
				<!-- <div><img src="img/line.gif" style="width: 420px; height: 1px;"></div>	-->		</td>
		</tr>

	</table>
	
	
	<br><table cellspacing=0 cellpadding=0 style="height: 10px; width: 420px;">
		<tr>			<td style="vertical-align: top;" id="font">
				<a href='#' onclick="window.close();" style="color: #FFFFFF">Cancel</a>
			</td>			<td style="vertical-align: top;">
					</td>
	</tr>
</table>
</center>